package com.hxx.service.impl;

import com.github.pagehelper.PageHelper;
import com.hxx.dao.MemberMapper;
import com.hxx.pojo.Member;
import com.hxx.service.IMemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MemberServiceImpl implements IMemberService {
    @Autowired
    private MemberMapper memberMapper;
    @Override
    public Member getMemberBynameAndPwd(Member sysmember) {
        Member member = memberMapper.getMemberBynameAndPwd(sysmember);
        return member;
    }

    @Override
    public Member getMemberByname(String name) {
        Member member = memberMapper.getMemberByname(name);
        return member;
    }


    @Override
    public List<Member> getAllMembers(String name,Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Member> allMembers = memberMapper.getAllMembers(name);
        return allMembers;
    }

    @Override
    public Member getMemberById(Integer id) {
        Member member = memberMapper.getMemberById(id);
        return member;
    }

    @Override
    public int addMember(Member sysmember) {
        int i = memberMapper.addMember(sysmember);
        return i;
    }

    @Override
    public int editMember(Member sysmember) {
        int i = memberMapper.editMember(sysmember);
        return i;
    }

    @Override
    public int deleteMemberById(Integer id) {
        int i = memberMapper.deleteMemberById(id);
        return i;
    }

    @Override
    public int deleteMemberAll(List<String> ids) {
        int i = memberMapper.deleteMemberAll(ids);
        return i;
    }
}
